package com.sunny.ynhz.adapter;

import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sunny.ynhz.R;
import com.sunny.ynhz.bean.OfficeAdminBean;

import java.util.List;

/**
 * Created by luao on 2017/8/4.
 */

public class OfficeAdminAdapter extends BaseQuickAdapter<OfficeAdminBean.DataBean, BaseViewHolder> {
    public OfficeAdminAdapter(@Nullable List<OfficeAdminBean.DataBean> data) {
        super(R.layout.item_office_admin, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, OfficeAdminBean.DataBean item) {
        RecyclerView recyclerView = (RecyclerView) helper.getView(R.id.details);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext);
        recyclerView.setLayoutManager(linearLayoutManager);

        switch (helper.getLayoutPosition()) {
            case 0:
                helper.setText(R.id.title, "市");
                ReportObjectAreaAdapter reportObjectAreaAdapter = new ReportObjectAreaAdapter(item.getArea());
                recyclerView.setAdapter(reportObjectAreaAdapter);
                break;
            case 1:
                helper.setText(R.id.title, "区");
                ReportObjectTownAdapter reportObjectTownAdapter = new ReportObjectTownAdapter(item.getTown());
                recyclerView.setAdapter(reportObjectTownAdapter);
                break;
            case 2:
                helper.setText(R.id.title, "镇(街)");
                ReportObjectVillageAdapter reportObjectVillageAdapter = new ReportObjectVillageAdapter(item.getVillage());
                recyclerView.setAdapter(reportObjectVillageAdapter);
                break;
            case 3:
                helper.setText(R.id.title, "河长");
                ReportObjectRiverChiefAdapter reportObjectRiverChiefAdapter = new ReportObjectRiverChiefAdapter(item.getRiverchief());
                recyclerView.setAdapter(reportObjectRiverChiefAdapter);
                break;
            default:
                break;
        }


    }
}
